home *** CD-ROM | disk | FTP | other *** search
/ .net 62 / dotnet_62_cd1.iso / pc / Redac / Scripts / net 60 Fevrier 2002 / Javascript / javascript.txt < prev   
Encoding:
Text File  |  2001-12-13  |  1.3 KB  |  49 lines

  1. <head>
  2. <SCRIPT language="javascript">
  3. function Valider(inscription){
  4.     if (inscription.email.value=="")
  5.         {
  6.         alert("Veuillez indiquer votre adresse email.");
  7.         inscription.email.focus();
  8.         return false;
  9.         }
  10.     if ((inscription.email.value.indexOf("@",0)<0)&&(inscription.email.value.indexOf(".",0)<0))
  11.         {
  12.         alert("Adresse email incorrecte. \nVeuillez corriger;");
  13.         inscription.email.focus();
  14.         return false;
  15.         }
  16.     if (inscription.age.value=="")
  17.         {
  18.         alert("Veuillez indiquer votre âge.");
  19.         inscription.age.focus();
  20.         return false;
  21.         }
  22.     if (isNaN(inscription.age.value))
  23.         {
  24.         alert("Votre âge n'est pas correct. \nVeuillez corriger.");
  25.         inscription.age.focus();
  26.         return false;
  27.         }
  28.     alert("Formulaire envoyé");
  29.     inscription.submit();
  30. }
  31. </SCRIPT>
  32. </head>
  33. <body>
  34. <form action="mailto:webmaster@abc.fr?subject='formulaire visiteur'" method="post" name="inscription">
  35. <p>Votre nom<br>
  36. <input type="text" name="nom" size=20 maxlength=30 value="Qui etes-vous ?" onFocus="if (this.value=='Qui etes-vous ?'){this.value=' '}">
  37. </p>
  38. <p>Votre adresse email<br>
  39. <input type="text" name="email" size=20></p>
  40. <p>Quel âge avez-vous ?
  41. <input type="text" name="age" size=2 maxlength=2> ans 
  42. </p>
  43. <input type="button" value="Envoyer" onClick="Valider(this.form)">
  44. <input type="reset" value="Annuler">
  45. </p>
  46. </form>
  47. </body>
  48.  
  49.